package com.example.dllo.keepdemo.train.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.dllo.keepdemo.R;
import com.example.dllo.keepdemo.base.BaseActivity;

/**
 * Created by dllo on 16/1/15.
 */
public class WorkoutsDetailActivity extends BaseActivity {
    private ImageView imgBack;
    private TextView tvContent,tvTrainTime,tvTime,tvTrainrule,tvRule,tvSuitperson,tvPerson;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_detail);
        imgBack = (ImageView) findViewById(R.id.img_activity_workouts_detail_back);
        tvContent = (TextView) findViewById(R.id.tv_activity_workouts_detail_content);
        tvTrainTime = (TextView) findViewById(R.id.tv_activity_workouts_detail_traintime);
        tvTime = (TextView) findViewById(R.id.tv_activity_workouts_detail_time);
        tvTrainrule = (TextView) findViewById(R.id.tv_activity_workouts_detail_trainrule);
        tvRule = (TextView) findViewById(R.id.tv_activity_workouts_detail_rule);
        tvSuitperson = (TextView) findViewById(R.id.tv_activity_workouts_detail_suitperson);
        tvPerson = (TextView) findViewById(R.id.tv_activity_workouts_detail_person);

        imgBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                WorkoutsDetailActivity.this.finish();
            }
        });

        initData();
    }

    private void initData() {
        Intent intent = getIntent();
        String details = intent.getStringExtra("detail");
        String[] str = details.split("####");
        tvContent.setText(str[0]);
        tvTrainTime.setText(str[1].substring(0,6));
        tvTime.setText(str[1].substring(6));
        tvTrainrule.setText(str[2].substring(0,5));
        tvRule.setText(str[2].substring(5));
        tvSuitperson.setText(str[3].substring(0, 5));
        tvPerson.setText(str[3].substring(5));

    }


}
